package org.tio.site.init;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tio.site.constant.CacheName;
import org.tio.site.utils.RedisUtils;
import org.tio.utils.cache.guavaredis.GuavaRedisCache;

/**
 * @author tanyaowu
 * 2017年8月10日 下午1:43:50
 */
public class CacheInit {
	private static Logger log = LoggerFactory.getLogger(CacheInit.class);

	public static final long SECOND_1 = 1L;

	public static final long MINUTE_1 = SECOND_1 * 60L;

	public static final long HOUR_1 = MINUTE_1 * 60L;

	public static final long DAY_1 = HOUR_1 * 24;

	public static void init() {
		//两级缓存
		GuavaRedisCache.register(RedisUtils.get(), CacheName.STATIC_RES, MINUTE_1 * 10, null);
		//		GuavaRedisCache.register(RedisUtils.get(), CacheName.LOGINNAME_USER, null, HOUR_1);
		//
		//		//redis缓存
		//		RedisCache.register(RedisUtils.get(), CacheName.EMAILAUTHCODE_USERID, null, MINUTE_1 * 15);
		//
		//		//每次启动时，清空部分缓存，防止垃圾数据
		//		RedisCache.getCache(CacheName.LOGINNAME_USER).clear();
		//		RedisCache.getCache(CacheName.USERID_USER).clear();
	}

	/**
	 * @param args
	 * @author tanyaowu
	 */
	public static void main(String[] args) {

	}

	/**
	 * @author tanyaowu
	 */
	public CacheInit() {
	}
}
